<?php
class QuestionsController extends AppController {
	public $paginate = array(
			//'fields' => array('Question.id', 'Question.title'),
			'limit' => 25,
			'order' => array(
					'Question.since' => 'desc'
			)
	);
	var $uses = array('Question','Questioncatch','Article');
	public function index() {
		$this->set('title_for_layout', 'Asking.vn');
		//$this->set('questions',$this->Question->getRecents(25));
		//$this->set('questions', $this->Question->find('all', array('limit'=>100)));
		
		$this->set('questioncatches',$this->Questioncatch->getCountQuestionsByFeatureCatchwords());
		$this->set('feature_articles', $this->Article->getFeatures());
		$questions = $this->paginate();
		if ($this->request->is('requested')) {
			return $questions;
		} else {
			$this->set('questions', $questions);
		}
		
	}
	public function view($id = null) {
		$this->set('question',$this->Question->getDetail($id));
		$this->set('questioncatches',$this->Questioncatch->getCountQuestionsByFeatureCatchwords());
	}
}